<!DOCTYPE html>
<html>
<head>
    <title>登录</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="description" content="木兰湾管理系统">
    <script type="text/javascript" src="../../static/include/header-css.js"></script>
    <style>
        .button-sp-area{margin:15px auto;padding:15px;text-align:center}
        .button-sp-area.cell{padding:15px 0}
        .content{
            position:fixed;
            left:0;
            right:0;
        }
        .weui-vcode-btn{
             display:inline-block;
             height:40px;
             margin-left:5px;
             padding:0 0.6em 0 0.7em;
             border-left:0px solid #E5E5E5;
             line-height:45px;
             vertical-align:middle;
             font-size:17px;
             color:#3CC51F;
         }
    </style>
</head>
<script type="text/javascript">	
    function doLogin(){
		var para =form2Json("login-form");
		var url='/main/loginAuth';
		doAjax(para,url,'POST',false,function(data){
			if(10022==data.code){
				getCode();
				$.toptip(data.message+'(code='+data.code+')', 'error');
			}else{
				localStorage.setItem('token', data.token);
				window.location.href='main.html';
			}
		});
    }
	function getCode(){
	    var url='/captcha/captchaImage';
	    doAjax2(null,url,'GET',false,false,function(data){
			var img = "data:image/gif;base64," + data.img;
	        setElementInnerHTML("codeImg",'<img src="'+img+'" height="40px" width="100px" />');
			 $("#uuid").val(data.uuid);
	    });
	}
</script>
<body class="content">
<br>
<div class="weui-cells__title" align="center">
    <img src="../../static/image/logo-large.png" alt="">
</div>
<div class="weui-cells__title" align="center">木兰湾管理系统</div>
<div class="weui-cells">
    <form id="login-form">
        <div class="weui-cell mulanbay_select-before">
            <div class="weui-cell__hd">
                <img src="../../static/image/user.png">
            </div>
            <div class="weui-cell__hd">
                <label class="weui-label">账号</label>
            </div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" placeholder="请输入用户名/手机" name="username">
            </div>
        </div>
        <div class="weui-cell mulanbay_select-before">
            <div class="weui-cell__hd">
                <img src="../../static/image/password.png">
            </div>
            <div class="weui-cell__hd">
                <label class="weui-label">密码</label>
            </div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="password" placeholder="请输入密码" name="password">
            </div>
        </div>
		<div class="weui-cell mulanbay_select-before">
		    <div class="weui-cell__hd">
		        <img src="../../static/image/captcha.png">
		    </div>
		    <div class="weui-cell__hd"><label class="weui-label">验证码</label></div>
			<div class="weui-cell__bd">
				<input class="weui-input" placeholder="请输入验证码" type="number" name="code">
			</div>
			<div class="weui-cell__ft">
				<div id="codeImg" onclick="getCode();"
					style="min-width: 130px; height: 53px; margin: 0 auto"></div>
			</div>
		</div>
		<input type="hidden" name='uuid' id="uuid"/>
    </form>
</div>
<div class="button-sp-area">
    <a href="javascript:doLogin();" class="weui-btn weui-btn_primary">登录</a>
    <a href="javascript:;" class="weui-btn  weui-btn_default">注册</a>
</div>
<div class="weui-footer">
    <p class="weui-footer__links">
        <a href="/html/main/main.html" class="weui-footer__link">电脑版</a>
    </p>
</div>
<script type="text/javascript" src="../../static/include/copyright.js"></script>
<script type="text/javascript" src="../../static/include/footer-js.js"></script>
<script type="text/javascript">
    $(function () {
        getCode();
    });
</script>
</body>
</html>